The present invention relates generally to the field of small computer system interface (SCSI)operation, and more particularly to a method of and system for managing the reselection of an initiator by a target on a SCSI bus.
In the implementation of small computer system interface (SCSI) devices, information transfer on a SCSI bus is allowed between two devices at a given time. An initiator device (typically a host adapter) originates an input/output (I/O) process and a target device (e.g., a disk drive) performs the I/O process originated by the initiator. The SCSI bus is a common resource that links the initiator and target together to complete the I/O process. The SCSI devices on the bus can be any combination of initiators and targets, provided there is at least one of each. The maximum number of SCSI devices that can be physically connected to the bus is determined by the width of the data path implemented.
Information may be transferred in a selection cycle or a reselection cycle. An initiator selection cycle is initiated by an initiator to start an I/O process between the initiator and a selected target. Occasionally, an I/O process may not be completed during a selection cycle. For example, during a write operation, the target""s input data buffer may become full. In that case the target may disconnect and free up the SCSI bus for other transfers while the target is processing the information in its buffer. As another example, during a read operation, the target may need more than a particular amount of time to seek to get the information. Again, the target may disconnect, and thereby free up the bus, while it is seeking to a particular location on the disk. In any event, when the target is ready to resume the I/O process, it does so by starting a reselection cycle.
The selection and reselection cycles both proceed through phases. An arbitration phase is the mechanism that a SCSI device uses to secure control of the SCSI bus for either a selection cycle or a reselection cycle. The arbitration phase is entered from a bus free phase. Each SCSI device is assigned a SCSI ID. Typically a host adapter is assigned the highest SCSI ID. Lower priority devices are assigned lower SCSI IDs. During the arbitration phase, each device desiring to secure control of the bus asserts its SCSI ID on the bus. At the end of the arbitration phase, each device arbitrating for the bus examines the data bus to determine if its ID is highest. If a device loses the arbitration, the device releases all signals and waits for the next bus free phase.
A device that wins the arbitration continues to the next phase and controls the SCSI bus until it releases all signals to the bus free phase. When an initiator wins arbitration, it continues to a selection phase to select the target device to which it wants to send an I/O process. When a target wins arbitration, it continues to a reselection phase to reselect an initiator with an outstanding I/O process.
Tagged queuing protocol allows an initiator to send multiple I/O processes to a target and allows the target to manage each I/O process to completion. Each I/O process sent to a target takes one selection cycle. During the tagged queuing selection cycle, the target places an I/O command in its command queue and then disconnects. An initiator can continue sending I/O processes to the target until its command queue is full. When the target is ready to perform an I/O process specified by a command in its command queue, the target attempts to start a reselection cycle. Each I/O process that completes takes one or more reselection cycles.
Bus contention occurs when tagged queuing is enabled and many I/O processes are sent to a target, or when multiple initiators and targets are connected to the SCSI bus. When an initiator and target are both arbitrating to secure control of the SCSI bus, the losing device must wait until the next bus free phase before it can rearbitrate. Currently, if a particular target loses arbitration and it is the device selected by the initiator, the target must finish placing the I/O process received from the initiator in its command queue before it can re-arbitrate for reselection. It takes a substantial amount of time to queue the I/O process and start the re-arbitration process for reselection. This amount of delay decreases bus utilization and I/O throughput.
The present invention provides a method of and a system for managing reselection of an initiator by a target on a SCSI bus. According to the present invention, the target attempts to secure control of the bus for a first reselection cycle to reselect the initiator. If the target fails to secure control of the bus for the first reselection cycle and the target is selected by the initiator for a selection cycle, the target processes the selection cycle first. However, concurrently with processing the selection cycle, substantially immediately after the bus becomes free, and before the target completes processing the selection cycle, the target attempts to secure control of the bus for a second reselection cycle to reselect the initiator.
If the target secures control of the SCSI bus for the second reselection cycle, the target pauses the second reselection cycle until the target at least partially processes the selection cycle. Preferably, the target at least partially processes the selection cycle by saving interrupt status registers. After the target has at least partially processed the selection cycle, the target completes the second reselection cycle and processing of the selection cycle concurrently.
The target of the present invention includes an interface controller, a programmable sequencer, and an interface processor. The interface controller, which is physically coupled to the SCSI bus, includes a reselection state machine. The programmable sequencer is operatively connected to the interface controller. The programmable sequencer is programmed to start the reselection state machine substantially immediately after the bus becomes free if the target is selected by the initiator and a reselection start indicator is set. The interface processor is operatively connected to the programmable sequencer and the interface controller. The interface processor is programmed to set the reselection start indicator at the start of a reselection cycle to reselect the initiator.
The programmable sequencer is programmed to pause a reselection cycle if the target secures the bus and the reselection start indicator is set. The interface processor is programmed to set a go reselection indicator after it has at least partially processed the selection cycle of the initiator, if the reselection start flag is set. The programmable sequencer is programmed to complete the reselection cycle when the interface processor sets the go reselection indicator.